﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace iot.models
{
    class Device
    {
        [Column("id")]
        public string Id { get; set; } = string.Empty;
        [Column("device_code")]
        [MaxLength(255)]
        public string DeviceCode { get; set; } = string.Empty;
        [Column("device_name")]
        [MaxLength(255)]
        public string DeviceName { get; set; } = string.Empty;
        [Column("description")]
        [MaxLength(255)]
        public string? Description { get; set; }
        [Column("device_type")]
        [MaxLength(255)]
        public string? DeviceType { get; set; }
        [Column("status")]
        [MaxLength(255)]
        public string? Status { get; set; }
        [Column("img")]
        [MaxLength(255)]
        public string Img { get; set; } = string.Empty;
        [Column("create_time")]
        public DateTime CreateTime { get; set; }
        [Column("update_time")]
        public DateTime UpdateTime { get; set; }

        public Device()
        {
  
        }

        public Device(string id, string deviceCode, string deviceName, string description, string deviceType, string status, string img)
        {
            Id = id;
            DeviceCode = deviceCode;
            DeviceName = deviceName;
            Description = description;
            DeviceType = deviceType;
            Img = img;
            Status = status;
            CreateTime = DateTime.Now;
            UpdateTime = DateTime.Now;
        }
    }
}
